﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;

/// <summary>
/// Summary description for Logger
/// </summary>
public static class Logger
{
    public static void WriteExceptionLog(Exception ex)
    {
        string logFolderPath = HttpContext.Current.Server.MapPath("Log");
        string filePath = logFolderPath + @"\" + DateTime.Now.ToString("ddMMyyyy") + ".log";

        StreamWriter sw = new StreamWriter(filePath, true);
        sw.WriteLine("======================================================");
        sw.WriteLine("Error:" + ex.Message + " Time:" + DateTime.Now.ToString());
        sw.WriteLine("======================================================");
        sw.WriteLine("Exception:" + ex.ToString());
        sw.WriteLine("======================================================");

        sw.Close();
    }
}